<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Editar Docente</h2>

            <p:panel styleClass="container_24 clearfix " style="background: none; border: none;"> 
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000" autoUpdate="true" showDetail="false"/>

                    <p class="subtitle">Dados Gerais</p>

                    <p:outputLabel value="Curso:" styleClass="grid_3" for="cursoSelectCheckboxMenu"
                                   rendered="#{managerCriarDocente.admin}"/>
                    <div class="grid_8">
                        <p:selectOneMenu id="cursoSelectCheckboxMenu"
                                         value="#{managerPesquisarDocente.cursoEditar}" 
                                         label="Selecione o curso" filter="true"
                                         filterMatchMode="contains"
                                         required="true" rendered="#{managerCriarDocente.admin}"
                                         converter="cursoconverter"
                                         caseSensitive="false" panelStyle="width:220px">
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerPesquisarDocente.cursos}" var="item" 
                                           itemLabel="#{item.nome}" itemValue="#{item}" />  
                            <p:ajax update=":form:disciplinaSelectCheckboxMenu" listener="#{managerPesquisarDocente.handleMudarDisciplinas}" />
                        </p:selectOneMenu>
                    </div>
                    <div class="clear" />

                    <p:outputLabel value="Docente:" styleClass="grid_3" for="docenteInputText" />
                    <p:inputText id="docenteInputText" styleClass="grid_8"
                                 required="true" value="#{managerPesquisarDocente.docenteEditar.nome}" />

                    <p:outputLabel value="Área:" styleClass="grid_3 alpha" for="areaInputText" />
                    <p:inputText id="areaInputText" styleClass="grid_8"
                                 value="#{managerPesquisarDocente.docenteEditar.area}" />
                    <div class="clear" />


                    <p:outputLabel value="Situação:" styleClass="grid_3" for="situacaoSelectOneMenu" />
                    <div class="grid_8">
                        <p:selectOneMenu id="situacaoSelectOneMenu" required="true"
                                         value="#{managerPesquisarDocente.docenteEditar.situacao}" panelStyle="width: 220px" >
                            <f:selectItem itemLabel="" itemValue="" />
                            <f:selectItems value="#{managerPesquisarDocente.situacao}"/>
                        </p:selectOneMenu>
                    </div>

                    <p:outputLabel value="Horas:" styleClass="grid_3" for="horasInputText" />
                    <p:inputText id="horasInputText" styleClass="grid_8" 
                                 value="#{managerPesquisarDocente.docenteEditar.horasAula}" />

                    <div class="clear"/>

                    <p:outputLabel value="Disciplinas:" styleClass="grid_3" >
                        <span class="ui-outputlabel-rfi">*</span>
                    </p:outputLabel>
                    <p:selectCheckboxMenu id="disciplinaSelectCheckboxMenu"
                                          value="#{managerPesquisarDocente.disciplinasSelecionadasEditar}" 
                                          label="Selecione a(s) disciplina(s)" filter="true"
                                          filterMatchMode="contains" styleClass="grid_8" 
                                          converter="disciplinaconverter" required="true"
                                          caseSensitive="false" panelStyle="width:290px">
                        <f:selectItems value="#{managerPesquisarDocente.disciplinasEditar}" 
                                       var="item" itemLabel="#{item.nome}" itemValue="#{item}" />  
                    </p:selectCheckboxMenu>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Atualizar" icon="ui-icon-disk" 
                                         actionListener="#{managerPesquisarDocente.atualizar()}" 
                                         update="@form" styleClass="ui-priority-primary"/>
                        <p:button value="Cancelar" icon="ui-icon-circle-close"
                                  href="pesquisardocente.xhtml"/>

                    </div>
                </h:form>
            </p:panel> 
        </ui:define>
    </ui:composition>
</html>